package com.study.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.study.model.dto.CreateMemoDto;
import com.study.model.dto.CreateMemoRespDto;
import lombok.Data;
import org.joda.time.DateTime;

@Data
@TableName
public class Memo {

    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    private String content;
    private String parentId;
    private String device;
    private String createTime;
    private String userId;

    public static Memo from(CreateMemoDto createMemoDto){
        Memo memo = new Memo();
        memo.setUserId(createMemoDto.getUserId());
        memo.setContent(createMemoDto.getContent());
        memo.setDevice(createMemoDto.getDevice());
        memo.setCreateTime(DateTime.now().toString("yyyy-MM-dd HH:mm:ss"));
        return memo;
    }
}
